\ProvidesPackage{ustcbeamer}

\RequirePackage{tikz}


\DeclareOption{bluetheme}{
	\definecolor{themecolor}{RGB}{0,64,152}     %科大校徽蓝
	}

\DeclareOption{redtheme}{
	\definecolor{themecolor}{RGB}{150,0,0}     %红色
	}

\DeclareOption{blacktheme}{
	\definecolor{themecolor}{RGB}{0,0,0}     %黑色
	}

\ExecuteOptions{bluetheme}
\ProcessOptions\relax

\def \globalscale {0.6330000}               %背景布大小
\definecolor{themecolor1}{RGB}{243,242,243} %灰色
\definecolor{themecolor2}{RGB}{234,235,237} %分割线颜色
%\useoutertheme{infolines}%
%\usefonttheme{serif}          %使用衬线字体，自行设置
%\setmainfont{Times New Roman} %全局英文字体，自行设置
%\setCJKmainfont{STKaiti}      %全局中文字体，自行设置
\defbeamertemplate*{headline}{BLANK}{}
\defbeamertemplate*{navigation symbols}{} %隐藏导航按钮

\setbeamerfont{frametitle}{size=\large}

\setbeamercolor{section in toc}{fg=black}
\setbeamercolor{block title}{fg=black}
\setbeamercolor{caption name}{fg=black}
\setbeamercolor{title}{fg=white}%
\setbeamercolor{frametitle}{fg=white}%
\setbeamercolor{item projected}{bg=themecolor}%
\setbeamercolor{item}{fg=themecolor}

\setbeamertemplate{items}[bullet]%
\setbeamertemplate{item}[bullet]%
\setbeamertemplate{sections/subsections in toc}[square]%


%--------------------
%模版
%--------------------
%标题页
\defbeamertemplate*{title page}{}[1][]{%
\strut\vfill\strut%
\begin{centering}%
\vfill\vfill\vfill\vfill%
{\usebeamercolor[fg]{title}\usebeamerfont{title}\inserttitle}%
\vfill%
\begingroup{\ifx\insertsubtitle\empty%
\else%
\usebeamercolor[fg]{title}\usebeamerfont{title}\large{\insertsubtitle}
\vfill%
\fi}\endgroup%
\begin{beamercolorbox}[center,#1]{author}%
\usebeamercolor[bg]{frametitle}\usebeamerfont{author}\insertauthor%
\end{beamercolorbox}\vfill%
\begin{beamercolorbox}[center,#1]{institute}%
\usebeamercolor[fg]{title}\usebeamerfont{institute}\insertinstitute%
\end{beamercolorbox}\vfill%
\begin{beamercolorbox}[center,#1]{date}%
\usebeamercolor[fg]{title}\usebeamerfont{date}\insertdate%
\end{beamercolorbox}%
\end{centering}
\vfill\vfill\vfill\vfill\vfill%
}%
%页脚
\defbeamertemplate*{footline}{footlineoff}{}
\defbeamertemplate*{footline}{footlineon}{%
\leavevmode%
  \ifnum\c@framenumber=1
  \else
  \vspace{-0.004\paperheight}\hspace{-0.01\paperwidth}
	\begin{beamercolorbox}[wd=.56\paperwidth,ht=.025\paperheight,left,dp=2ex]{section in footline}
	\insertsectionnavigationhorizontal{.5\textwidth}{}{}
	\end{beamercolorbox}
	\begin{beamercolorbox}[wd=.25\paperwidth,right,dp=2ex]{shorttitle in footline}
	\quad\insertshorttitle
	\end{beamercolorbox}
	\begin{beamercolorbox}[wd=.1\paperwidth,right,dp=2ex]{shortauthor in footline}
	\insertshortauthor
  \end{beamercolorbox}
	\begin{beamercolorbox}[wd=.08\paperwidth,right,dp=2ex]{page in footline}
	{\insertframenumber{}}/{\inserttotalframenumber\quad}
	\end{beamercolorbox}
  \fi%
}
\setbeamercolor{shorttitle in footline}{fg=white}
\setbeamercolor{section in footline}{fg=white}
\setbeamercolor{shortauthor in footline}{fg=white}
\setbeamercolor{page in footline}{fg=white}

\setbeamerfont{section in head/foot}{size={\fontsize{6}{6}}}
\setbeamercolor{section in head/foot}{fg=white,bg=themecolor}
\setbeamertemplate{section in head/foot shaded}[default][35]%被暗淡的其他标题；调节系数为fg!35!bg

%大纲页
\setbeamerfont{section in toc}{size={\fontsize{14}{14}}}
\setbeamercolor{section in toc}{fg=themecolor,bg=white}
\setbeamertemplate{section in toc shaded}[default][35]%被暗淡的其他标题；调节系数为fg!35!bg
%\setbeamerfont{section in toc}{size={\fontsize{6}{6}}}
\setbeamercolor{subsection in toc}{fg=themecolor,bg=white}
\setbeamertemplate{subsection in toc shaded}[default][35]%被暗淡的其他标题；调节系数为fg!35!bg

%beamerbaseauxtemplates.sty
\defbeamertemplate*{subsection in toc}{subsectionhorizontal}%
{\leavevmode%
	\ifnum\inserttocsubsectionnumber=1
	\hspace{3.7ex}%
 	\else
	\fi
    \usebeamercolor[bg]{subsection number projected}%
    \vrule width1ex height1ex\kern1ex\inserttocsubsection}
\setbeamertemplate{subsection in toc}[subsectionhorizontal]

%--------------------
%命令
%--------------------
%开始演示

\newcommand{\maketitleframe}{
	%取消footline,sidebar
	\setbeamertemplate{footline}[footlineoff]
	%%设置本命令以后的背景如下
	\usebackgroundtemplate{%
			\input{./theme/ustc_cover.tex}
	}%
	%封面页
	\begin{frame}%
		\maketitle%
	\end{frame}%
	%设置本命令以后的背景如下
	\usebackgroundtemplate{%
			\input{./theme/ustc_background.tex}
	}%
}%
%


